package com.tac.service.wms.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tac.common.result.Result;
import com.tac.dao.wms.InventoryApprovalManagementDao;
import com.tac.pojo.wms.InventoryApprovalManagement;
import com.tac.service.wms.InventoryApprovalManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class InventoryApprovalManagementServiceImpl implements InventoryApprovalManagementService {

    @Autowired
    private InventoryApprovalManagementDao inventoryApprovalManagementDao;

    //查看入库申请列表
    public Result<PageInfo<InventoryApprovalManagement>> getList(Integer pageNum, Integer pageSize, String applicationNumber, String relatedDocumentNumber, String businessType, String supplier
            , String contractNumber, String contractType, String applicant, Date applicationDateStart, Date applicationDateEnd, String applicationStatus
            ,String reviewer, Date reviewDateStart, Date reviewDateEnd, String reviewStatus){
         PageHelper.startPage(pageNum, pageSize);
        List<InventoryApprovalManagement> list = inventoryApprovalManagementDao.getList(applicationNumber, relatedDocumentNumber, businessType, supplier, contractNumber, contractType, applicant, applicationDateStart, applicationDateEnd,applicationStatus, reviewer,reviewDateStart, reviewDateEnd, reviewStatus);
        PageInfo<InventoryApprovalManagement> inventoryApprovalManagementPageInfo = new PageInfo<>(list);
        return Result.success(inventoryApprovalManagementPageInfo);
    }


    //修改审核意见
    public Result update(InventoryApprovalManagement inventoryApprovalManagement){
        Integer integer = inventoryApprovalManagementDao.update(inventoryApprovalManagement);
        if(integer>0){
            return Result.success(null);
        }
        return Result.error("修改失败");
    }
}
